<?
    $zone = $request->get("zone", "");
    $instance_id = $request->get("instance_id", "0");
    my @players = $EQW->ListPlayers($zone, $instance_id);
    my $player_count = @players;
    print "{";
    print "\"player_count\" : $player_count,";
    print "\"players\" : ";
    print "[";

    my $i = 0;
    for my $player (@players) {
        my $pd = $EQW->GetPlayerDetails($player);

        print "{";
        print "\"character\" : \"$pd->{character}\",";
        print "\"account\" : \"$pd->{account}\",";
        print "\"account_id\" : \"$pd->{account_id}\",";
        print "\"location_short\" : \"$pd->{location_short}\",";
        print "\"location_long\" : \"$pd->{location_long}\",";
        print "\"ip\" : \"$pd->{ip}\",";
        print "\"level\" : \"$pd->{level}\",";
        print "\"race\" : \"$pd->{race}\",";
        print "\"race_id\" : \"$pd->{race_id}\",";
        print "\"class\" : \"$pd->{class}\",";
        print "\"class_id\" : \"$pd->{class_id}\",";
        print "\"guild_id\" : \"$pd->{guild_id}\",";
        print "\"guild\" : \"$pd->{guild}\",";
        print "\"status\" : \"$pd->{status}\",";
        print "\"client_version\" : \"$pd->{client_version}\"";
        print "}";

        if($i != $player_count - 1) {
            print ",";
        }
        $i++;
    }

    print "]";
    print "}";

?>